package com.otom.bcel;

import java.util.ArrayList;
import java.util.List;

public class ValidationException extends RuntimeException {
	private List<String> errors = new ArrayList<String>();
	
	public ValidationException() {
		
	}
	public ValidationException(String error) {		
		errors.add(error);
	}


	public ValidationException(List<String> errors) {		
		this.errors = errors;
	}
	
	public ValidationException(Throwable throwable, String error) {
		super(throwable);		
		errors.add(error);
	}

	public List<String> getErrors() {
		return errors;
	}

	public void setErrors(List<String> errors) {
		this.errors = errors;
	}	
	
	@Override
	public String getMessage() {
		String str = "";
		for (String error : errors) {
			str += error + "\n";
		}
		return str.substring(0, str.length() - 1);
	}
}
